import request from '@/utils/request'

export function getFileList(params) {
    return request({
        url: '/files',
        method: 'get',
        params
    })
}

export function uploadFile(data) {
    return request({
        url: '/files',
        method: 'post',
        headers: {
            'Content-Type': 'multipart/form-data'
        },
        data
    })
}

export function downloadFile(pathVariable) {
    return request({
        url: '/files/' + pathVariable,
        method: 'get',
        responseType: 'blob'
    })
}

export function updateFile(data) {
    return request({
        url: '/files',
        method: 'put',
        data
    })
}

export function createFolder(data) {
    return request({
        url: '/files',
        method: 'post',
        data
    })
}

export function deleteFile(pathVariable) {
    return request({
        url: '/files/' + pathVariable,
        method: 'delete'
    })
}

export function searchFile(params) {
    return request({
        url: '/files',
        method: 'get',
        params
    })

}
